#ifndef __SOUND_H__
#define __SOUND_H__

#pragma comment(lib,"SDL.lib")
#pragma comment(lib,"SDL_mixer.lib")

#include <vector>
#include "cLog.h"
#include "SDL.h"
#include "SDL_mixer.h"
using namespace std;

#define FREQUENCY 44100         //CD Quality
#define FORMAT    AUDIO_S16SYS  //Format Sample
#define CHANNELS  2             //Numeber Channels 2 Stereo
#define CHUNKSIZE 4096          //Default 4096
#define VOLUME_LEVEL    128     //Music Volume 0 to 128
#define MAX_MUSICS 3            

class cSound 
{

     private:
		 
		cLog *Log;
		vector<Mix_Music*> gameMusics;
		vector<Mix_Chunk*> soundEffects;
		string nameTrack;

     public:
     
		cSound(void);
		~cSound(void);

		bool Init(void);
		bool loadMusics(string filename);
		bool loadSoundEffects(string filename);
		void freeMusics();
		void freeSoundEffects();
		void play(int track,int loop); //loop: number of times to play through the music. 
		                               //      0 plays the music zero times.   
		                               //     -1 plays the music forever (or as close as it can get to that)		
		void pause();
		void resume();
		void stop();
		void playSoundEffect(int track,int loop,int channel); // channel:Channel to play on, or -1 for the first free unreserved channel.
		                                                      // track: Number track to play
		                                                      // loop:  Number of loops, -1 is infinite loops.
		                                                      //        Passing one here plays the sample twice (1 loop). 
};
#endif